import multi_robot_problem as robprob
from random import randint
from sys import maxint
robs = ((1,1),(6,8))
dirt = ((1,0),(0,1),(2,2),(8,8))
obs  = ((5,5),)

p1=robprob.MultiRobotState(9,9,robs,dirt,obs)

simple = robprob.MultiRobotState(7,9,
                                 ((2,2),),
                                 ((1,1),(3,1),(5,1)),
                                 ()
                                 )


def random_problem(max=maxint):
    x = randint(0,max)
    y = randint(0,max)
    def rand_xy():
        return (randint(0,x-1),randint(0,y-1))
    robs = []
    num_robots = randint(0,x*y)
    for i in range(num_robots):
        rob = rand_xy()
        while (rob in robs):
            rob = rand_xy()
        robs.append(rob)
    dirts = []
    num_dirts  = randint(0,x*y-num_robots)
    for i in range(num_dirts):
        dirt = rand_xy()
        while (dirt in dirts or dirt in robs):
            dirt = rand_xy()
        dirts.append(dirt)
    obs = []
    num_obs  = randint(0,x*y-num_robots-num_dirts)
    for i in range(num_obs):
        ob = rand_xy()
        while (ob in dirts or ob in robs or ob in obs):
            ob = rand_xy()
        obs.append(ob)
    return robprob.MultiRobotState(x,y,tuple(robs), tuple(dirts), tuple(obs))
